package day1;

import java.util.Scanner;

public class Demo9 {
    public static void main(String[] args) {
        //输⼊⼀个数，判断其是否为完全数
        System.out.println("请输入一个数");
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        if(num<=1){
            System.out.println("不是完全数");
            return;
        }
        int sum = 1;
        for (int i = 2; i <=Math.sqrt(num); i++) {
            if(num%i==0){
              sum+=i;
             if(i!=num/i){
                 sum+=num/i;
             }
            }
        }
        if(sum==num){
            System.out.println(num+"是完全数");
        }else {
            System.out.println(num+"不是完全数");
        }
    }
}
